package com.bsc.minacommand.model;

import com.bsc.minacommand.json.AbstractTransJson;
import com.bsc.minacommand.json.TransJson;

public abstract class AbstractBscCommand implements BscCommand {

    public BscCommand commandFormBystes(byte[] bytes, Class bc) throws Exception {
        AbstractTransJson atj = new TransJson();
        return (BscCommand) atj.TransJsonByte(bc, bytes);
    }

    public String CommandName() {
        return this.getClass().getSimpleName();
    }

    public byte[] bodyToBytes() throws Exception {
        AbstractTransJson atj = new TransJson();
        return atj.TransJsonObject(this);
    }

    public String toString() {
        return "Command : " + CommandName();
    }
}
